GtkWindow: Fix the down-scaling in icon_from_list()
authorKjell Ahlstedt <kjellahlstedt@gmail.com>
Mon, 13 Nov 2017 11:48:57 +0000 (12:48 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 26 Nov 2017 23:54:59 +0000 (18:54 -0500)
Must use floating-point division to get the correct scale factors.
cairo_set_source_surface() must be called after cairo_scale().

https://bugzilla.gnome.org/show_bug.cgi?id=790287

gtk/gtkwindow.c

index 01bc34ec2c3822e6a16db201bb576bcd4603b001..0ffd0063886b7675263c8a19f5d994658c79b3ef 100644 (file)
@@ -4544,10 +4544,10 @@ icon_from_list (GList *list,
 
   target = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
   cr = cairo_create (target);
-  cairo_set_source_surface (cr, source , 0, 0);
   cairo_scale (cr,
-              size / gdk_texture_get_width (texture),
-              size / gdk_texture_get_height (texture));
+              (double) size / gdk_texture_get_width (texture),
+              (double) size / gdk_texture_get_height (texture));
+  cairo_set_source_surface (cr, source, 0, 0);
   cairo_paint (cr);
   cairo_destroy (cr);
   cairo_surface_destroy (source);